home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d12
/
cgazv5n5.arc
/
LZW3.C
< prev
next >
Wrap
C/C++ Source or Header
|
1991-09-23
|
1KB
|
36 lines
/*--- LZW3.C ----------------------------- Listing 4 ----
* Contents: I/O Utility routines for LZW coding.
* containing the following routines:
* my_read
* my_write
*
* Author: Dwayne Phillips
* Compiler: Microsoft C 6.0a, BC++ 2.0
* Note: Must link with at least an 8K stack
* Date: February 1991
* May be used freely if authorship is acknowledged
*-------------------------------------------------------*/
#include "lzw.h"
unsigned my_read( FILE *file, void *buffer,
size_t size, size_t n )
{
size_t rval;
rval = fread ( buffer, size, n, file );
if ( ferror ( file )) {
printf ( "Error while reading input file.\n" );
exit ( 1 );
}
return rval;
}
void my_write ( FILE *file, void *buffer,
size_t size, size_t n )
{
fwrite ( buffer, size, n, file );
if ( ferror ( file )) {
printf( "Error while writing output file.\n" );
exit ( 1 );
}
}